<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>改变背景颜色</title>
    <style>

    </style>
</head>
<body>
    <input type="button" value="红色" onclick="color('red')">
    <input type="button" value="蓝色" onclick="color('blue')">
    <input type="button" value="棕色" onclick="color('brown')">
    <script>
        function color(a){
            document.querySelector("body").style.background=a;
        }
    </script>
</body>
</html>